package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Scheduling {
    private int schedulingId;
    private Timestamp schedulingTime;
    private SchedulingClass schedulingClassBySchedulingClassesId;
    private User userByUserId;

    @Id
    @Column(name = "scheduling_id", nullable = false)
    public int getSchedulingId() {
        return schedulingId;
    }

    public void setSchedulingId(int schedulingId) {
        this.schedulingId = schedulingId;
    }

    @Basic
    @Column(name = "scheduling_time", nullable = true)
    public Timestamp getSchedulingTime() {
        return schedulingTime;
    }

    public void setSchedulingTime(Timestamp schedulingTime) {
        this.schedulingTime = schedulingTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Scheduling that = (Scheduling) o;
        return schedulingId == that.schedulingId &&
                Objects.equals(schedulingTime, that.schedulingTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(schedulingId, schedulingTime);
    }

    @ManyToOne
    @JoinColumn(name = "scheduling_classes_id", referencedColumnName = "scheduling_classes_id")
    public SchedulingClass getSchedulingClassBySchedulingClassesId() {
        return schedulingClassBySchedulingClassesId;
    }

    public void setSchedulingClassBySchedulingClassesId(SchedulingClass schedulingClassBySchedulingClassesId) {
        this.schedulingClassBySchedulingClassesId = schedulingClassBySchedulingClassesId;
    }

    @ManyToOne
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    public User getUserByUserId() {
        return userByUserId;
    }

    public void setUserByUserId(User userByUserId) {
        this.userByUserId = userByUserId;
    }
}
